<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<>
<script type="text/javascript" src="js1/jquery-1.11.1.js"></script>
<input type="checkbox">香蕉
<input type="checkbox">苹果
<input type="checkbox">橘子
<input type="checkbox">全选/全不选
<script type="text/javascript">
    var c=0
    $(":checkbox:not(:last)").each(function (i, obj) {
        $(obj).click(function () {
            if ($(obj).prop("checked") == false) {
                $(":checkbox:last").prop("checked", false);
            } else {
                $(":checkbox:not(:last)").each(function (i,obj) {
                    if ($(obj).prop("checked") == true) {
                        c++
                        console.log(c)
                    }
                    if (c == 3) {
                        $(":checkbox:last").prop("checked", true);
                    }

                })
                c=0
            }
        });
    });
    $(":checkbox:last").click(function () {
        $(":checkbox:not(:last)").each(function (i, obj) {
            $(obj).prop("checked", $(":checkbox:last").prop("checked"))
        })
    })
</script>
</body>
</html>